From: Florian Müllner Date: Thu, 20 Nov 2025 14:51:23 +0000 (+0100) Subject: swipeTracker: Flip pan gesture velocity in RTL locales X-Git-Tag: archive/raspbian/50.5-1+rpi1~1^2~66^2^2~5 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=2b2c7dfa4be8c2ce8b05e0ab4d95a7f0693b5b56;p=gnome-shell.git swipeTracker: Flip pan gesture velocity in RTL locales Like the gesture delta, the final velocity needs to be flipped in RTL locales, otherwise we end up cancelling out the gesture progress. Part-of: (cherry picked from commit 799a842d3a11b9d0df0e69d2d6a07ce66f926ba2) --- diff --git a/js/ui/swipeTracker.js b/js/ui/swipeTracker.js index 18f6657db..16138622b 100644 --- a/js/ui/swipeTracker.js +++ b/js/ui/swipeTracker.js @@ -653,8 +653,8 @@ export const SwipeTracker = GObject.registerClass({ _endPanGesture(panGesture) { const velocity = panGesture.get_velocity(); const v = this.orientation === Clutter.Orientation.HORIZONTAL - ? -velocity.get_x() - : -velocity.get_y(); + ? this._getGestureDirFactor() * velocity.get_x() + : this._getGestureDirFactor() * velocity.get_y(); this._endGesture(v, this._distance, false); } @@ -679,6 +679,14 @@ export const SwipeTracker = GObject.registerClass({ this._endGesture(0, this._distance, false); } + _getGestureDirFactor() { + if (this.orientation === Clutter.Orientation.HORIZONTAL && + Clutter.get_default_text_direction() === Clutter.TextDirection.RTL) + return 1; + + return -1; + } + /** * Confirms a swipe. User has to call this in 'begin' signal handler, * otherwise the swipe wouldn't start. If there's an animation running,